#include "hashmap.h"
#include <iostream>
#include <vector>

vector<int> twoSum(vector<int>& nums, int target) {
	HashTable<int, int> hash;
	for (int i = 0; i < nums.size(); ++i) {
		if (hash.count(target - nums[i])) {
			return {hash[target - nums[i]], i};
		}
		hash.insert(nums[i], i);
	}
	return { -1, -1 };
}
int main(void) {
	/*HashTable<int, int> hash;
	hash.insert(2, 3);
	hash.insert(3, 4);
	hash.remove(3);
	cout << hash[2] << endl;
	cout << hash.count() << endl;
	cout << hash.count(3) << endl;
	cout << hash.count(2) << endl;

	HashTable<int, int> hash1(hash);
	cout << hash1[2] << endl;
	cout << hash1.count() << endl;

	HashTable<int, int> hash2 = hash;
	cout << hash2[2] << endl;
	cout << hash2.count() << endl;

	HashTable<int, int> hash3 = std::move(hash);
	cout << hash3[2] << endl;
	cout << hash3.count() << endl;

	cout << hash.count() << endl;*/

	vector<int> nums{ 2, 7, 11, 5 };
	vector<int> res = twoSum(nums, 9);
	for (auto& e : res) {
		cout << e << endl;
	}
	return 0;
}